package com.cn.demo.redisson;

import org.redisson.Redisson;
import org.redisson.api.RMapCache;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;

/**
 * 描述
 *
 * @author wangjf
 * @version 1.0
 * @createDate 2019/12/13 10:41
 * @projectName demo
 */
public class RedissonMain {

    public static void main(String[] args) {

        Config config = new Config();
        config.useSingleServer()
                .setTimeout(1000000)
                .setAddress("redis://192.168.199.32:16380")
                .setPassword("123456");

        RedissonClient redisson = Redisson.create(config);

        RMapCache<String, String> map = redisson.getMapCache("wjf_test");

        String test = map.putIfAbsent("test", "aaaaa");
        System.out.println(test);


        String test2 = map.putIfAbsent("test", "bbbb");
        System.out.println(test2);


    }

}
